package com.order.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

@Configuration
public class SwaggerConfig {
 
        @Bean //swagger中所有的功能都封装在Docket类中
    public Docket docket() {
            Docket docket1 = new Docket(DocumentationType.SWAGGER_2)
                    .apiInfo(apiInfo())//设置api文档信息
                    .select()
                    //指定为哪些包下的类生成接口文档。
                    .apis(RequestHandlerSelectors.basePackage("com.order.controller"))
                    .build();
            return docket1;
        }
         //定义自己接口文档信息
        public ApiInfo apiInfo (){
            Contact DEFAULT_CONTACT = new Contact("薛大", "http://www.baidu.com", "2575037612@qq.com");
            ApiInfo apiInfo = new ApiInfo("xdl的在线文档", "这是最牛文档", "1.0MAX", "http://www.jd.com",
                    DEFAULT_CONTACT, "GGBoy科技", "http://www.taobao.com", new ArrayList<VendorExtension>());
            return apiInfo;
        }
 
}